package com.pheruagor.handmanager.controller {
    import com.pheruagor.handmanager.model.ClubViewerProxy;
    import com.pheruagor.handmanager.model.business.Club;
    import com.pheruagor.handmanager.view.ClubViewerMediator;
    import com.pheruagor.handmanager.view.component.ClubViewer;

    import mx.core.UIComponent;

    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.command.SimpleCommand;

    public class OpenClubViewerCommand extends SimpleCommand {
        public static const NAME:String = "openClubViewerCommand";
        public static const EXECUTED:String = NAME + "Executed";

        override public function execute(notification:INotification):void {
            var container:UIComponent = UIComponent(notification.getBody().container);
            var clubViewer:ClubViewer = new ClubViewer();
            clubViewer.percentHeight = 100;
            clubViewer.percentWidth = 100;
            var club:Club = Club(notification.getBody().club);
            facade.registerProxy(new ClubViewerProxy(club));
            facade.registerMediator(new ClubViewerMediator(clubViewer));
            container.addChild(clubViewer);
        }
    }
}